package com.example.interceptor_demo.controller;

import com.example.interceptor_demo.common.ResultAjax;
import com.example.interceptor_demo.model.User;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/getuser")
    public ResultAjax getUser() {
        System.out.println("do getUser");
        return ResultAjax.succ("user");
    }

    @RequestMapping("/reg")
    public ResultAjax reg() {
        System.out.println("do reg");
        return ResultAjax.succ("reg");
    }

    @RequestMapping("/login")
    public ResultAjax login() {
        System.out.println("do login");
        return ResultAjax.succ("login");
    }

    @RequestMapping("/getstr")
    public String getstr() {
        return "hello";
    }

    @RequestMapping("/user")
    public User user() {
        User user = new User();
        user.setId(1);
        user.setName("张三");
        user.setPassword("123");
        return user;
    }


}
